package com.framerock.baselib;

import java.net.URLEncoder;
import java.util.Map;

/**
 * REIM使用
 * */
public class REIM {

    /**
     * 发送推送消息
     * */
    public static RockMsg push(String surl, Map<String, String> arr)
    {
        RockMsg rockmsg = RockMsg.obj();
        String data = Json.getJsonString(arr);

        data = URLEncoder.encode(data);
        String url  = surl+"?atype=send&data="+data+"";

        final String[] result   = {""};
        final int[] bianhao     = {0};
        RockHttp.sendurl(url,"GET","", new CallBack(){
            @Override
            public void backhttp(int code, int arg1, String bstr) {
                result[0]  = bstr;
                bianhao[0] = code;
            }
        },1000);
        String cont = result[0];
        if(Rock.isEmpt(cont) || bianhao[0] != AA.HTTPB_SUCCESS)return rockmsg.error("地址不能用:"+cont+"");
        return rockmsg.success(cont);
    }
}
